import 'package:fish_redux/fish_redux.dart';
import 'package:flutter/material.dart';
import 'package:flutter_html/flutter_html.dart';
import 'package:school_safe_teacher/resourse/app_colors.dart';
import 'package:school_safe_teacher/widget/my_widget.dart';

import 'action.dart';
import 'state.dart';

Widget buildView(
    NewsDetailState state, Dispatch dispatch, ViewService viewService) {
  return getParent(
      child: Container(
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            Row(
              children: [
                GestureDetector(
                  child: Container(
                    padding: EdgeInsets.fromLTRB(5, 15, 5, 5),
                    child: Image.asset(
                      "images/arrow_left@2x.png",
                      width: 20,
                      height: 20,
                    ),
                  ),
                  onTap: () {
                    Navigator.of(viewService.context).pop(1);
                  },
                ),
                Expanded(
                  child: Text(""), // 中间用Expanded控件
                ),
              ],
            ),
            Container(
              child: Row(children: [
                Expanded(child: Text("")),
                Text(
                  state.newsEntity.title,
                  textAlign: TextAlign.center,
                  maxLines: 1,
                  style: TextStyle(
                      fontWeight: FontWeight.bold,
                      fontSize: 17,
                      color: AppColors.deepTextColor),
                ),
                Expanded(child: Text("")),
              ],),
              margin: EdgeInsets.only(top: 30),
            ),
            Container(
              child: Text(
                state.newsEntity.createTime,
                textAlign: TextAlign.start,
                style: TextStyle(
                    fontSize: 11,
                    fontWeight: FontWeight.normal,
                    color: AppColors.smallTextColor),
              ),
              margin: EdgeInsets.only(top: 30),
            ),
            Html(
              data: state.newsEntity.content,
            )
          ],
        ),
      ),
      context: viewService.context);
}
